package jay.home.bet.web.struts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jay.home.bet.domain.User;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class AddAdminUserAction extends BaseAction
{
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception
	{
		AddAdminUserForm addAdminUserForm = (AddAdminUserForm) form;
		try
		{
			User newUser = new User();
			newUser.setUsername(addAdminUserForm.getUsername());
			newUser.setPassword(addAdminUserForm.getPassword());
			newUser.setActive(addAdminUserForm.getActive());
			newUser.setBalance(addAdminUserForm.getBalance());
			newUser.setOnline(addAdminUserForm.getOnline());
			getaccountService().insertUser(newUser);
			return mapping.findForward("SUCCESS");
		} catch (Exception e)
		{
			return mapping.getInputForward();
		}
	}
}
